<template>
	<view id="voteRecord">
		<view class="vote-wrap" v-for="item in voteRecordList" :key="item.id" @click="voteDetail(item)">
			<view class="vote-item">
				<view class="title">
					{{proName}} --
					{{
				  item.vote_type == 0 ? '附议投票' 
				: item.vote_type == 1 ? '筹备组推举' 
				: item.vote_type == 2 ? '委员推举'
				: item.vote_type == 4 ? '主任推举'
				: item.vote_type == 5 ? '副主任推举'
				: ''
				 }}
				</view>
				<view class="date">{{ item.vote_time }}</view>
			</view>
		</view>
		<view v-if="voteRecordList.length == 0">
			<view style="width: 232px;height: 242px;margin: 110px auto;">
			  <image style="width: 100%;height: 100%;" src="../../../static/image/9015d0e9f45344c4007d408cd271f6a.png" mode=""></image>
			</view>
			<view style="width: 62%;margin: -66px auto;text-align: center;color: #999;">暂无数据</view>
		</view>
	</view>
</template>
<!--投票-->
<script>
	export default {
		props: ['id', 'proName'],
		data() {
			return {
				voteRecordList: [],
				voteId: this.id,
				user_id: uni.getStorageSync('rawData').userId,
			}
		},

		mounted() {
			this.getRecordList();
		},
		methods: {
			getRecordList() {
				this.$requestYz.api.getRecordList({
					essential_information_id: this.voteId,
					user_id: this.user_id
				}).then(res => {
					this.voteRecordList = res.data.data.datalist
				})
			},
			voteDetail(item) {
				//成立业委会附议投票，跳转页面
				if(item.vote_type != 0){
					return;
				}
				uni.navigateTo({
					url: '../vote/voteRecordDetail?id=' + item.essential_information_id + '&time='+item.vote_time
				})
			}
		}
	}
</script>

<style lang="scss">
	#voteRecord {
		.vote-wrap {
			width: 100%;
			height: 204rpx;
			background: #FFFFFF;
			margin-top: 20rpx;

			.vote-item {
				padding: 40rpx 30rpx;
			}

			.title {
				font-weight: bold;
				font-size: 32rpx;
			}

			.date {
				margin-top: 40rpx;
				font-size: 28rpx;
			}
		}
	}
</style>
